package org.dubbo.service.impl;

import org.apache.dubbo.config.annotation.Service;
import org.dubbo.bean.UserVo;
import org.dubbo.entity.User;
import org.dubbo.mapper.UserMapper;
import org.dubbo.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    
    @Override
    public void register(UserVo user) {
        User u = new User();
        BeanUtils.copyProperties(user, u);
        userMapper.insert(u);
    }

    @Override
    public UserVo getUserById(int id) {
        User u = userMapper.selectById(id);
        UserVo vo = new UserVo();
        BeanUtils.copyProperties(u, vo);
        return vo;
    }

}
